/*
 * Copyright (c) 2008-2013 Haulmont. All rights reserved.
 * Use is subject to license terms, see http://www.cuba-platform.com/license for details.
 */

package com.haulmont.asu.entity;

import com.haulmont.chile.core.annotations.Composition;
import com.haulmont.chile.core.annotations.NamePattern;
import com.haulmont.cuba.core.entity.StandardEntity;

import javax.persistence.*;
import java.util.List;

/**
 * Author: Sergey42
 * Date: 14.10.13 12:33
 */

@Table(name = "EXT_COMMISSION")
@Entity(name = "ext$Commission")
@NamePattern("%s|name")
public class Commission extends StandardEntity {

    private static final long serialVersionUID = -6779969039269824881L;

    @Column(name = "NAME", length = 100)
    protected String name;

    @Column(name = "NUMBER", length = 50)
    protected String number;

    @Column(name = "SEANCE_YEAR")
    protected Integer seanceYear;

    @OneToMany(mappedBy = "commission")
    @Composition
    protected List<CommissionMember> members;

    @OneToMany(mappedBy = "commission")
    @OrderBy("defenseDate")
    protected List<DefenseDay> defenseDays;

    public Integer getSeanceYear() {
        return seanceYear;
    }

    public void setSeanceYear(Integer seanceYear) {
        this.seanceYear = seanceYear;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public List<CommissionMember> getMembers() {
        return members;
    }

    public void setMembers(List<CommissionMember> members) {
        this.members = members;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<DefenseDay> getDefenseDays() {
        return defenseDays;
    }

    public void setDefenseDays(List<DefenseDay> defenseDays) {
        this.defenseDays = defenseDays;
    }
}
